package com.example.common.entity;

import jakarta.persistence.*;
import lombok.Data;

import java.math.BigInteger;


@Entity
@Table(name = "sys_user_jobs")
@Data
public class SysUserJobs {
    
    @EmbeddedId
    private SysUserJobsId id;
    
    @ManyToOne
    @MapsId("userId")
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    private SysUser sysUser;
    
    @ManyToOne
    @MapsId("jobId")
    @JoinColumn(name = "job_id", referencedColumnName = "job_id")
    private SysJob sysJob;
    
    @Transient
    public BigInteger getUserId() {
        return sysUser.getUserId();
    }
    
    public void setUserId(BigInteger userId) {
        SysUser user = new SysUser();
        user.setUserId(userId);
        this.sysUser = user;
    }
    
    @Transient
    public BigInteger getJobId() {
        return sysJob.getJobId();
    }
    
    public void setJobId(BigInteger jobId) {
        SysJob job = new SysJob();
        job.setJobId(jobId);
        this.sysJob = job;
    }
}
